<?php

class Default_ContaController extends Zend_Controller_Action
{
    public function cadastroAction()
    {
    	$form = new SON_Forms_UsuarioCadastro();
    	$form->setAction(Zend_Controller_Front::getInstance()->getBaseUrl() . "/conta/cadastro");
    	
    	$this->view->form = $form;
    	
    	if($this->_request->isPost()) {
    		$data = $this->_request->getPost();
    		if($form->isValid($data)) {
    			$usuario = new Usuario($data);
    			$usuario->save();
    			$this->_redirect("auth");
    		} else {
    			$this->view->error = $form->getMessages();
    		}
    	}
    }
}

